package com.googlecode.jawb.tests.saving;

import com.googlecode.jawb.BinaryType;
import com.googlecode.jawb.ListenerTarget;
import com.googlecode.jawb.clues.SetArray;
import com.googlecode.jawb.clues.SetItemPostVisitListener;
import com.googlecode.jawb.clues.SetType;

public class Saving_A {
	@SetType(type = BinaryType.UINT_8)
	private short valA = 0xAA;
	
	@SetType(type = BinaryType.OBJECT)
	private Saving_B valB = new Saving_B();
	
	@SetType(type = BinaryType.UINT_8)
	@SetArray(staticLength = 3)
	private short[] val_B = new short[]{0xA, 0xB, 0xC};
	
	@SetType(type = BinaryType.UINT_16)
	private long valC = 0x6677;
	
	@SetType(type = BinaryType.UINT_32)
	private long valD = 0x99887766;
	
	@SetType(type = BinaryType.UINT_8)
	@SetArray(staticLength = 4)
	@SetItemPostVisitListener(target = ListenerTarget.OUTPUT)
	private byte[] array = {1, 2, 3, 4};
	
	@SuppressWarnings("unused")
	private int onItemPostVisitArray(int index, ListenerTarget currentOperation) {
		if (currentOperation == ListenerTarget.OUTPUT) {
			return index + 1;
		}
		
		return index;
	}
}
